package com.ts.notice;

import com.alibaba.fastjson.JSON;
import com.ts.common.core.utils.ApacheHttpUtils;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.http.util.EntityUtils;

import java.util.HashMap;
import java.util.Map;

public class SmsDemo {

    public static void main(String[] args) {
        
//        query();
//        send();
        System.out.println(RandomStringUtils.random(4,true,true));
        System.out.println(RandomStringUtils.random(4,true,true));
        System.out.println(RandomStringUtils.random(4,false,false));

    }

    private static void query() {
        String host = "https://jmsms.market.alicloudapi.com";
        String path = "/sms/send-status?mobile=13480743727&taskId=JS2654172321128340";
        String method = "GET";
        String appcode = "b53df72a6209403b88c6b7c7e737d6a0";

        Map<String, String> headers = new HashMap<String, String>();
        headers.put("Authorization", "APPCODE " + appcode);

        String url = ApacheHttpUtils.getUrl(host + path,headers);
        System.out.println(url);
    }

    public static void send(){
        String host = "http://jmsms.market.alicloudapi.com";
        String path = "/sms/send?mobile=13480743727&templateId=M105EABDEC&value=8888";
        String method = "POST";
        String appcode = "b53df72a6209403b88c6b7c7e737d6a0";
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("Authorization", "APPCODE " + appcode);

        Map<String, String> querys = new HashMap<String, String>();
        querys.put("mobile", "13480743727");
        querys.put("templateId", "M72CB42894");
        querys.put("value", "8888");

        Map<String, String> bodys = new HashMap<String, String>();


        String s = ApacheHttpUtils.postJson(host + path, headers, null);
        System.out.println(s);
    }
}
